<div style="width: 100%; padding-bottom: 20px">
	<span id="counter-box">
		<div class="global-nav">
			<ul>
				<li>
					<h4 class="pull-left" style="display: inline-block;font-weight: initial;font-size: 16px">精彩评论</h4>
				</li>
			</ul>
		</div>
	</span>
	<span id="post-box">
		<div class="uyanpost">
			<div class="resetbox sectionbox">
					<div class="blockbox">
						<div class="postarea">
							<div class="postborder">
								<textarea name="content"></textarea>
							</div>
							<div style="display: block;text-align: right;margin-top:8px">
								<button class="btn btn-info" onclick="subcomment()">发 送</button>
							</div>
						</div>
						<input type="hidden" id="book_id" value="{$book.id}">
						<input type="hidden" id="session_uid" value="{$xwx_user_id|default=-1}">
					</div>
				</div>
		</div>
	</span>
	<span id="nav-box">
		<div class="nav">
			<div class="nav-left">
				<span style="font-size: 16px;"> 最新评论</span>
			</div>
			<div class="claer"></div>
		</div>
	</span>
	<span id="posts">
		<ul id="post-list" class="post-list">
            {volist name="comments" id="vo" key="k"}
			<li class="post">
				<div class="post-content">
					<div class="avatar hovercard">
						<div class="user">
							<img src="/static/images/user-icon.png">
                        </div>
						<div style="color:#666;font-size: 12px;text-align: center;margin-top: 5px">
                            {$vo.user.nick_name|default=$vo.user.username}
                        </div>
					</div>
					<div class="post-body">
						<div class="post-body-inner">
							<div data-role="message-container" class="post-message-container">
								<div data-role="message-content">
									<div class="post-message publisher-anchor-color">
										<p>{$vo.content|raw}</p>
									</div>
								</div>
							</div>
						</div>
						<div class="u-footer">
							<div class="time-ago">{$i}楼 {$vo.create_time|date='Y-m-d H:i:s'}</div>
						</div>
					</div>
				</div>
			</li>
            {/volist}
		</ul>
	</span>
	<span id="loadmore" style="display: none;"></span>
	<div class="ujian-uyan"></div>
</div>
<script>
	function subcomment() {
		console.log(111)
		var uid = $('#session_uid').val();
		var comment = $('#content').val();
		var book_id = $('#book_id').val();
		if (uid == '-1') {
			layer.msg('请先登录', {icon: 0,shade: 0.3})
		} else if (comment.length <= 0) {
			layer.msg('请勿提交空评论', {icon: 0,shade: 0.3})
		} else {
			$.post({
				url: '/commentadd',
				data: {comment: comment, book_id: book_id},
				success(res) {
					if (res.err == 1) {
						layer.msg(res.msg,{icon: 0,shade: 0.3})
					} else {
						layer.msg(res.msg,{icon: 1,shade: 0.3})
						setTimeout(function () {
							location.reload();
						},1000)
					}
				},
				error(res) {
					layer.msg('表单提交出错', {icon: 0,shade: 0.3})
				}
			})
		}
	}
</script>